package com.yhos.platform.oopston.core.base;

import java.util.Collections;
import java.util.List;

public class Page<T> {

    private static final long serialVersionUID = 1L;

    private List<T> records = Collections.emptyList();

    private long total = 0;

    private int size = 10;

    private int current = 1;

    private long pages = 0;

    public Page() {

    }

    public Page(int current, int size, long pages, long total) {
        this.current = current;
        this.size = size;
        this.pages = pages;
        this.total = total;
    }

    public Page(int current, int size, long pages, long total, List<T> records) {
        this.current = current;
        this.size = size;
        this.pages = pages;
        this.total = total;
        this.records = records;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getCurrent() {
        return current;
    }

    public void setCurrent(int current) {
        this.current = current;
    }

    public long getPages() {
        return pages;
    }

    public void setPages(long pages) {
        this.pages = pages;
    }

    @Override
    public String toString() {
        StringBuilder pg = new StringBuilder();
        pg.append(" Page:{ [").append(super.toString()).append("], ");
        if (records != null) {
            pg.append("records-size:").append(records.size());
        } else {
            pg.append("records is null");
        }
        return pg.append(" }").toString();
    }

}
